To show one workflow for setting up a Windows pc for compiling OpenCPN.
The pc used was a 'win-32-x86 machine', running Windows 8.1.
If you are running 'x64' you will need to download the 64 bit installers for some of the programs used here. This applies to:
The steps will follow the instructions here.
'Navigate' means using 'Windows Explorer' to find a folder or file.
'cd' or 'CD' is used in a Terminal window to 'change directory' (aka 'change folder')
https://www.visualstudio.com/downloads
Note:
Get the Git installation packages from https://git-for-windows.github.io/
Get the latest 'Poedit' installation package from http://www.poedit.net
Note: If you look in the 'C:\Program Files\Poedit\GettextTools\bin' folder you will see the file 'msgfmt.exe' which does the work of the program.
In case you want to create installation packages, install NSIS Unicode 2.46.5 from http://www.scratchpaper.com/
There is a “bug” in CMake, which only looks at “HKEY_LOCAL_MACHINE\SOFTWARE\NSIS” for the installation location of NSIS
The Unicode version adds its registry key in “HKEY_LOCAL_MACHINE\SOFTWARE\NSIS\Unicode”.
Some registry tweaking is needed.
Note: If you are running a 64-bit machine (x64) the key is located in 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432node\NSIS\Unicode'
Note: If you are running a 64-bit machine (x64) the location is 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432node\NSIS'.
To make the installer package use proper language name translations, it is necessary to modify file 'C:\Program Files\NSIS\Unicode\Contrib\Language files\Norwegian.nsh' and change the line
!insertmacro LANGFILE "Norwegian" "Norwegian"
to
!insertmacro LANGFILE "Norwegian" "Norsk"
The 'C:\Program Files\NSIS\Unicode\Contrib\Language files\Norwegian.nsh' is edited.
Due to 'Security' you will need to add 'Write' permission to this file. Without this you will not be able to save the changes.
1) <wxdir>\src\zlib\gzguts.h - line 102
change:
Code: Select all
#ifdef _MSC_VER
# define snprintf _snprintf
#endif
to:
Code: Select all
#if (defined(_MSC_VER) && (_MSC_VER <1900))
#define snprintf _snprintf
#endif
2) <wxdir>\src\tiff\libtiff\tif_config.h - line 367
change:
Code: Select all
#define snprintf _snprintf
to:
Code: Select all
#if (defined(_MSC_VER) && (_MSC_VER <1900))
#define snprintf _snprintf
#endif
3) <wxdir>\include\wx\propgrid\advprops.h - line 453
change:
Code: Select all
wxDateTime GetDateValue() const
{
//return m_valueDateTime;
return m_value;
}
to:
Code: Select all
wxDateTime GetDateValue() const
{
//return m_valueDateTime;
return m_value.GetDateTime();
}
Line numbers based on wxWidgets 3.0.2 (not the latest development version).
You will find that a number of files have been made in the folder 'c:\wxWidgets-3.0.2\lib\vc-dll'.
Some of the filenames start 'wxmsw30u' and others 'wxmsw30ud' corresponding to the 'Release' and 'Debug' versions.
This completes the preparations for building the OpenCPN program.
git clone git://github.com/OpenCPN/OpenCPN.git
Note: If you want the source code for the latest stable release (4.4.0 at time of writing) you need to locate that source on GitHub.com:
https://github.com/OpenCPN/OpenCPN/tree/v4.4.0
Sorry, this needs another program - 7Zip.

'7z' files can now be opened and extracted with this program.

mkdir build
cd build cmake -T v140_xp ..
* Close the Terminal window.
* This has created the Visual Studio solution file 'OpenCPN.sln'.
wxmsw30u_richtext.lib wxmsw30u_adv.lib wxmsw30u_propgrid.lib wxmsw30u_aui.lib
This assumes that you have installed 'NSIS' (The guide was here).
OpenCPN (Version 4.4.0) and the four plugins included in the source files have been built successfully.
In order to run the setup on Windows XP it is necessary to download and run the 'Microsoft Visual C++ Redistributable 2015' installer
This was downloaded from here. I had problems with the version I found elsewhere on Microsoft.